<template>
	<view class="content" :style="{
      'padding-top': height + 'px',
    }">
		<view :style="{
	  height: statusBarHeight + 'px',
	}">
		</view>
		<view class="head" :style="{
		  top: statusBarHeight + 'px',
		}">
			<view class="head_left">
				<u-icon name="arrow-left" color="#000" size="24" :bold="true" @click="toBack"></u-icon>
			</view>
			<view class="text">黑名单成员</view>

		</view>

		<view class="title">
			黑名单成员
		</view>

		<view class="box">
			<view class="box_item" v-for="(item,index) in list" v-if="item.user" @click="jiechu(item)">
				<view class="item_url">
					<image :src="item.user.avatar_url" mode=""></image>
				</view>
				<view class="item_text">
					{{item.user.nick_name}}
				</view>
				<view class="btn" @click="yichu(item)">
					移除
				</view>
			</view>
		</view>


		<u-modal :show="show" :title="title" :content='content'>
			<view slot="default">
				{{content}}
			</view>
			<view class="confirmButton" slot="confirmButton">
				<view class="button_colse" @click="show = false">
					取消
				</view>
				<view class="xian">

				</view>
				<view class="button_submit" @click="submit">
					确定
				</view>
			</view>
		</u-modal>
		<floatingBall></floatingBall>
	</view>
</template>

<script>
	import {
		userList,
		jiechulahei
	} from '@/common/api/start.js'
	export default {
		data() {
			return {
				statusBarHeight: 0,
				height: 0,
				id: -1,
				list: [],
				show: false,
				title: '提示',
				content: '是否确定将该成员移除黑名单?',
				items: {}
			}
		},
		created() {
			const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度
			const windowHeihgt = statusBarHeight.windowHeight;
			this.statusBarHeight = statusBarHeight.statusBarHeight;
			this.$nextTick(() => {
				uni
					.createSelectorQuery()
					.select(".head")
					.boundingClientRect((data) => {
						this.height = data.height;
					})
					.exec();
			});
		},
		onLoad(options) {
			if (options && options.id) {
				this.id = options.id;
				this.getList();
			}
		},
		methods: {
			getList() {
				userList({
					type: 2,
					xinghe_id: this.id
				}).then(res => {
					console.log('resssss', res);
					this.list = res.data.list.data;
				}).catch(err => {

				})
			},
			jiechu(item) {
				console.log('iiiiiitemmmmm', item);
				this.items = item;
				this.show = true;
			},
			submit() {
				console.log('111', this.items);
				jiechulahei({
					xinghe_id: this.id,
					user_id: this.items.user.user_id
				}).then(res => {
					this.show = false;
					this.getList();
					console.log('resssss', res);
				}).catch(err => {
					this.show = false;
				})
			},
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		box-sizing: border-box;
	}

	.head {
		width: 100%;
		padding: 18rpx 30rpx 47rpx;
		position: fixed;
		display: flex;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
		z-index: 99;

		.head_left {
			position: absolute;
			left: 30rpx;
		}

		.text {
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: 400;
		}
	}

	.title {
		width: 100%;
		padding: 0 30rpx;
		box-sizing: border-box;
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #444444;
	}

	.box {
		width: 100%;
		padding: 0 30rpx;
		box-sizing: border-box;
		padding-top: 24rpx;
		box-sizing: border-box;

		.box_item {
			width: 100%;
			display: flex;
			align-items: center;
			margin-top: 32rpx;
			position: relative;

			.item_url {
				width: 100rpx;
				height: 100rpx;

				image {
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
			}

			.item_text {
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #444444;
				margin-left: 24rpx;
			}

			.btn {
				width: 180rpx;
				height: 64rpx;
				background: #55B877;
				border-radius: 32rpx 32rpx 32rpx 32rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #FFFFFF;
				position: absolute;
				right: 0;
			}
		}
	}

	/deep/ .u-modal__button-group--confirm-button {
		padding: 0;
		box-sizing: border-box;
	}

	.confirmButton {
		width: 100%;
		height: 112rpx;
		display: flex;
		align-items: center;
		border-top: 1rpx solid #eee;
		padding: 0 !important;
		box-sizing: border-box;

		.button_colse {
			width: 50%;
			font-size: 32rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #272727;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.xian {
			width: 2rpx;
			height: 56rpx;
			background: #eee;
		}

		.button_submit {
			width: 50%;
			font-size: 32rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #55B877;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}
</style>